package com.woniu.microworkorderserver.workgroupmag.mapper;

import com.woniu.microcommonsserver.entity.WorkgroupUserInfoEntity;
import com.woniu.microcommonsserver.param.PageRequest;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface WorkGroupUserMapper {

    /**
     * 新增数据
     * */
    long save(@Param("w") WorkgroupUserInfoEntity entity);

    /**
     * 删除数据
     * */
    @Delete("delete from workgroup_user_info where fk_work_group_id = #{id}")
    void delete(@Param("id") long workGroupId);

    /**
     * 根据用户组id查询用户id
     * */
    int[] findByGroupId(@Param("workGroupId") long workGroupId);

    /**
     * 根据用户组id查询用户id
     * */
    int[] findByUserId(@Param("userId") long userId);

    /**
     * 分页查询
     * */
    List<WorkgroupUserInfoEntity> findPage(PageRequest request);

}
